from pathlib import Path
import zipfile

# 解压的目标路径
target_path = Path.cwd()
zippath = Path('test.zip')
# 创建ZipFile对象
zip_file = zipfile.ZipFile(zippath)
# 需要被解压的文件
need_unzip = ['1.txt', '2.txt']
# 返回zip文件中包含的所有文件和文件夹列表
names = zip_file.namelist()
print(names)
for fn in names:
    # 判断需解压的文件是否包含在fn中
    files = [f for f in need_unzip if f in fn]
    if files:
        print(fn)
        # 解压某个文件
        zip_file.extract(fn, target_path)


zip_file.close()
print('done!')